package zip;

import Util.CreateFileUtil;
import org.openjdk.jmh.annotations.Benchmark;
import java.util.Base64;

/**
 * JDK GZIP test
 */
public class Base64Test extends TestParent {
    protected byte[] compressFile = CreateFileUtil.getBytesByFile("./demo.json");
    protected byte[] deCompressFile = CreateFileUtil.getBytesByFile("./demo.base64");

    @Benchmark
    public byte[] Base64Encode (){
        byte[] out = Base64.getEncoder().encode(compressFile);
        CreateFileUtil.bytes2File(out,"./","demo.base64");
        return out;
    }

    @Benchmark
    public byte[] Base64Decode (){
        return Base64.getDecoder().decode(deCompressFile);
    }
}
